using System.Collections.Generic;

namespace WeiboSharp.Models
{
    public class Parameter
    {
        public string Name { get; set; }

        public string Value { get; set; }

        public ParameterType Type { get; set; }

        public Parameter(string name, string vlaue)
        {
            Name = name;
            Value = vlaue;
        }
    }

    public class OAuthParameter : Parameter
    {
        public OAuthParameter(string name, string value)
            : base(name, value)
        {
            Type = ParameterType.OAuth;
        }
    }

    /// <summary>
    /// Comparer class used to perform the sorting of the query parameters
    /// </summary>
    public class ParameterComparer : IComparer<Parameter>
    {
        public int Compare(Parameter x, Parameter y)
        {
            return x.Name == y.Name ? string.Compare(x.Value, y.Value) : string.Compare(x.Name, y.Name);
        }
    }

    public enum ParameterType
    {
        Cookie,
        GetOrPost,
        UrlSegment,
        HttpHeader,
        OAuth,
        //RequestBody
    }
}
